const inflect = require('i')();
const pool = require('../util/mysql');
const user=require('../model/user');
/**
 * use inflect ,please see https://www.npmjs.com/package/i
 */
class userBase{
    constructor(id,siteId,dataCenterId,numPartis,loginName,){
        this.id=id;
        this.site_id=siteId;
        this.data_center_id=dataCenterId;
        this.num_partis=numPartis;
    };
    getListById= async function(options){
        
    }
    create= async function(options){
          const promisePool= pool.promise();
          const [rows,fields]= await  promisePool.query("insert into t_user_base set ?",options);
          console.log(rows,"rows");
          console.log(fields,"fields");
         
          return rows;
        //inflect.underscore(this.siteId)
    }
    deleteById= function(id){

    }
    update= function(id,options){
        
    }
    getOneById = async function(id){
          const promisePool= pool.promise();
          const [rows,fields]= await  promisePool.query("select id,site_id from t_user_base where id = ?",id);
          console.log(rows,"rows");
          console.log(fields,"fields");
          let one=await user.findOne({name:'abc4',age:22});
          //const userone=await user.create({name:'abc4',age:22});
          console.log(`结果：${one}`);
          return rows;
    }
}
module.exports = new userBase();
